﻿@model List<bonus.Models.Notice>
@{
	Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
	ViewBag.Title = "公告列表";
}

@section Top {
	@Html.Partial("_Top")
}
<style>
  #dataTable td {
  overflow: hidden; 
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align:middle;
}
  table {
  table-layout: fixed
}
</style>
<link href="https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css" rel="stylesheet" />
<div class="container-fluid">
	<ol class="breadcrumb">
		<li class="breadcrumb-item">
			公告
		</li>
		<li class="breadcrumb-item active">公告列表</li>
	</ol>
	<div class="card mb-3">
		<div class="card-header">
			<i class="fa fa-table"></i> 公告列表
		</div>
		<div class="card-body">
			<table class="table table-bordered text-center" id="dataTable" width="100%" cellspacing="0">
				<thead>
					<tr>
						<th>标题</th>
						<th style="width:30%">内容</th>
                        <th>公司是否显示</th>
                        <th>服务中心是否显示</th>
                        <th>用户是否显示</th>
						<th>时间</th>
						@if (Services.Cookie.GetUserType() == bonus.Models.Grade.AMDIN)
						{
							<th>操作</th>
						}
					</tr>
				</thead>
				<tbody>
					@foreach (var item in Model)
					{
						<tr>
							<td>@item.Title</td>
							<td class="tooltip-test"  title="@item.Title" data-container="body" data-toggle="popover" data-placement="bottom" data-content="@Html.Raw(item.Content)">@item.Content</td>
                            <td>
                                @if (item.IsCampay)
                                {
                                   <a href="javascript:void(0);" onclick="isType('@item._id','2',this)"> 已显示 </a>
                                }
                                else
                                {
                                    <a href="javascript:void(0);" onclick="isType('@item._id','2',this)"> 未显示 </a>
                                }
                            </td>
                            <td>
                                @if (item.IsCenter)
                                {
                                    <a href="javascript:void(0);" onclick="isType('@item._id','1',this)"> 已显示 </a>
                                }
                                else
                                {
                                    <a href="javascript:void(0);" onclick="isType('@item._id','1',this)"> 未显示 </a>
                                }
                            </td>
                            <td>
                                @if (item.IsUser)
                                {
                                    <a href="javascript:void(0);" onclick="isType('@item._id','0',this)"> 已显示 </a>
                                }
                                else
                                {
                                    <a href="javascript:void(0);" onclick="isType('@item._id','0',this)"> 未显示 </a>
                                }
                            </td>
							<td>@item.AddDT.ToString("yyyy-MM-dd")</td>
							@if (Services.Cookie.GetUserType() == bonus.Models.Grade.AMDIN)
							{
								<td style="vertical-align:middle; width:6%; text-align:center">
									<button type="button" onclick="del('@item._id.ToString()')" class="btn btn-danger">
										删除
									</button>
								</td>
							}
						</tr>
					}
				</tbody>
			</table>
		</div>
		<div class="card-footer small text-muted">数据跟新时间为 @DateTime.Now.ToString("yyyy-MM-dd")</div>
	</div>
</div>

<script src="~/Scripts/sb-admin.js"></script>
<script src="~/Scripts/NoticeList.js"></script>
